package com.wf.service;

import com.wf.bean.UserWf;
import com.wf.mapper.UserWfMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserWfMapperService {

    @Autowired
    UserWfMapper userWfMapper;

    public UserWf getUserWfById(Integer id) {
        return userWfMapper.getItById(id);
    }

    public ArrayList<UserWf> getUserAll() {
        return userWfMapper.getItAll();
    }
    public int getWfCount(){
        return userWfMapper.getWfCount();
    }

    // 添加一个
    // public int insertOneWf(UserWf wf);
    public void insertOneWf(UserWf wf){
        userWfMapper.insertOneWf(wf);
//        return 0;
    }


    // 删除一个
    // public int deleteOneWfId(Integer id);
    public void deleteOneWfId(Integer id){
        userWfMapper.deleteOneWfId(id);
//        return 0;
    }


    // 更新一个
    // public int updateOneWf(UserWf wf);
    public void updateOneWf(UserWf wf){
        userWfMapper.updateOneWf(wf);
//        return 0;
    }


    // 删除ids
    public void deleteMulWfByIds(List<Integer> ids){
        userWfMapper.deleteMulWfByIds(ids);
    }
    // 批量查询
    public ArrayList<UserWf> getItByIds(List<Integer> ids) {
        return userWfMapper.getItByIds(ids);
    }
    // 批量插入
    public void insertMulWf(List<UserWf> wfs){
         userWfMapper.insertMulWf(wfs);
    }
    // 批量修改
    public void updateMulWf(List<UserWf> wfs){
        userWfMapper.updateMulWf(wfs);
    }

    // 分页查询
    public ArrayList<UserWf> getPageList(int pageNum,int pageSize){
        pageNum = (pageNum-1)*pageSize;
       return userWfMapper.getPageList(pageNum,pageSize);
    }

    // 按名称模糊查询
    public ArrayList<UserWf> vagueSearch(String wfname){
      return  userWfMapper.vagueSearch(wfname);
    }

    //按名称模糊查询个数
    public int valueGetWfCountByName(String wfname){
        return  userWfMapper.valueGetWfCountByName(wfname);
    }
    //按名称模糊分页查询
    public  ArrayList<UserWf> vaguePageSearch(int pageNum,int pageSize,String wfname){
        pageNum = (pageNum-1)*pageSize;
        return userWfMapper.vaguePageSearch(pageNum,pageSize,wfname);
    }
}
